NPM assumes quite strongly that it manages the project as a
whole and its package/lock files are located in the project
root.
While we somehow managed to keep the npm tooling in a subfolder,
this comes at the cost of breaking imports of additional modules.
This will become relevant when we update eslint to a supported
version, as we want to keep using the `junit` formatter in CI,
which has now been split out into a separate module.
So bite the bullet and make the node_modules folder available in
the project root.
On the plus side, having the node_modules folder in the project
root allows language servers in IDEs/editors to pick it up.
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3929>
# SPDX-FileCopyrightText: 2020 Philip Chimento <philip.chimento@gmail.com>
# SPDX-FileCopyrightText: 2025 Florian Müllner <fmuellner@gnome.org>
-cd $(dirname -- "$0")
+srcdir=$(dirname -- "$0")
+
+cd $srcdir
[ ! -d node_modules ] && npm clean-install
+# Link in project root to make imports work properly
+[ ! -e ../node_modules ] && ln -s $srcdir/node_modules ../node_modules
npm run lint -- "$@"